/*************
Ten tac gia : LY THIEN KIM
Ngay tao : 8/16/2011
Noi dung : update 1 HISTORY

*************/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE NAME = 'sp_UpdateHISTORY')
BEGIN
	DROP PROC sp_UpdateHISTORY
END
GO
CREATE PROC sp_UpdateHISTORY
	@ID				int,
	@DETAIL			text,
	@DATE			datetime,
	@PLACE			varchar(40),
	@Last_updated	datetime,
	@Result			int out
	AS
	BEGIN	
		IF EXISTS (SELECT * FROM HISTORY WHERE ID = @ID)
		BEGIN
			UPDATE HISTORY SET  DETAIL = @DETAIL,DATE = @DATE,PLACE = @PLACE,Last_updated = @Last_updated
			WHERE ID = @ID
			SET @Result = 1	
		END
		else
		BEGIN
			SET @Result = 0
		END
	END